﻿package com.wandian.util
{
	import flash.display.*;
	import flash.filters.*;

	/**
	 * 投影效果工具类
	 * @author long
	 */
	public class GlowFilterManage extends Sprite
	{
		private var arrGrayscale:Array;
		private static var _glow:GlowFilterManage;

		public function GlowFilterManage()
		{
			this.arrGrayscale=[0.3, 0.59, 0.11, 0, 0, 0.3, 0.59, 0.11, 0, 0, 0.3, 0.59, 0.11, 0, 0, 0, 0, 0, 1, 0];
			return;
		} // end function

		public function getGrayscale():Array
		{
			var _color:*=new ColorMatrixFilter(this.arrGrayscale);
			return [_color];
		} // end function

		public function getYellowGlow():BitmapFilter
		{
			var _color:*=this.glowFilterYellow();
			return _color;
		} // end function

		public function getRedGlow():BitmapFilter
		{
			var _color:*=this.glowFilterRed();
			return _color;
		} // end function

		public function getSearchBurg():BitmapFilter
		{
			var _color:*=this.glowFilterSearch();
			return _color;
		} // end function

		public function getSelect():BitmapFilter
		{
			var _color:*=this.glowFilterSelect();
			return _color;
		} // end function

		public function getYellowFilter():BitmapFilter
		{
			var _color:*=this.yellowGlowFilter();
			return _color;
		} // end function

		public function getGreenFilter():BitmapFilter
		{
			var _color:*=this.greenGlowFilter();
			return _color;
		} // end function

		private function glowFilterYellow():BitmapFilter
		{
			var _color:Number=65280;
			var _alpha:Number=1;
			var _blurX:Number=5;
			var _blurY:Number=5;
			var _strength:Number=1.5;
			var _inner:Boolean=false;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.HIGH;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		private function glowFilterRed():BitmapFilter
		{
			var _color:Number=16711680;
			var _alpha:Number=1;
			var _blurX:Number=5;
			var _blurY:Number=5;
			var _strength:Number=1.5;
			var _inner:Boolean=false;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.HIGH;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		private function glowFilterSearch():BitmapFilter
		{
			var _color:Number=16724736;
			var _alpha:Number=1;
			var _blurX:Number=5;
			var _blurY:Number=5;
			var _strength:Number=3;
			var _inner:Boolean=false;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.HIGH;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		private function glowFilterSelect():BitmapFilter
		{
			var _color:Number=16724736;
			var _alpha:Number=1;
			var _blurX:Number=5;
			var _blurY:Number=5;
			var _strength:Number=3;
			var _inner:Boolean=false;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.HIGH;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		private function yellowGlowFilter():BitmapFilter
		{
			var _color:Number=16777113;
			var _alpha:Number=1;
			var _blurX:Number=10;
			var _blurY:Number=10;
			var _strength:Number=5;
			var _inner:Boolean=false;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.HIGH;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		private function greenGlowFilter():BitmapFilter
		{
			var _color:Number=10079232;
			var _alpha:Number=1;
			var _blurX:Number=5;
			var _blurY:Number=5;
			var _strength:Number=3;
			var _inner:Boolean=false;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.HIGH;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		public function getYellowLight():BitmapFilter
		{
			var _color:Number=16777113;
			var _alpha:Number=1;
			var _blurX:Number=5;
			var _blurY:Number=5;
			var _strength:Number=3;
			var _inner:Boolean=false;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.HIGH;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		public function getRedLight():BitmapFilter
		{
			var _color:Number=16711680;
			var _alpha:Number=1;
			var _blurX:Number=5;
			var _blurY:Number=5;
			var _strength:Number=5;
			var _inner:Boolean=true;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.LOW;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		public function getHightLight():BitmapFilter
		{
			var _color:Array=[1, 0, 0, 0, 50, 0, 1, 0, 0, 50, 0, 0, 1, 0, 50, 0, 0, 0, 1, 0];
			var _alpha:*=new ColorMatrixFilter(_color);
			return _alpha;
		} // end function

		public function getUpGame():GlowFilter
		{
			var _color:*=new GlowFilter();
			_color.blurX=20;
			_color.blurY=20;
			_color.strength=1.5;
			_color.quality=BitmapFilterQuality.MEDIUM;
			_color.color=65280;
			_color.alpha=1;
			_color.knockout=false;
			_color.inner=true;
			return _color;
		} // end function

		public function getSelectFilter():BitmapFilter
		{
			var _color:Number=14343294;
			var _alpha:Number=1;
			var _blurX:Number=15;
			var _blurY:Number=15;
			var _strength:Number=2.7;
			var _inner:Boolean=false;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.HIGH;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		public function getGlowFilter():BitmapFilter
		{
			var _color:Number=0;
			var _alpha:Number=1;
			var _blurX:Number=2;
			var _blurY:Number=2;
			var _strength:Number=5;
			var _inner:Boolean=false;
			var _knockout:Boolean=false;
			var _quality:*=BitmapFilterQuality.LOW;
			return new GlowFilter(_color, _alpha, _blurX, _blurY, _strength, _quality, _inner, _knockout);
		} // end function

		public static function getInstance():GlowFilterManage
		{
			if (GlowFilterManage._glow == null)
			{
				GlowFilterManage._glow=new GlowFilterManage;
			}
			return GlowFilterManage._glow;
		} // end function

	}
}
